home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
TUTORIAL
/
1307B.ZIP
/
LOCMOD1.MOD
< prev
next >
Wrap
Text File
|
1989-01-18
|
1KB
|
47 lines
(* Chapter 13 - Program 1 *)
MODULE LocMod1;
FROM InOut IMPORT WriteString, WriteCard, WriteLn;
VAR Index : CARDINAL;
MODULE LocalStuff;
EXPORT GetNumber; (* Nothing else is visible outside *)
(* Nothing outside is visible here *)
VAR Counter : CARDINAL;
PROCEDURE GetNumber() : CARDINAL;
BEGIN
Counter := Counter + 3;
RETURN Counter;
END GetNumber;
BEGIN
Counter := 4; (* This is only run at load time *)
END LocalStuff;
BEGIN (* Main program *)
FOR Index := 1 TO 8 DO
WriteString("The count is now ");
WriteCard(GetNumber(),8);
WriteLn;
END; (* Do loop *)
END LocMod1.
(* Result of execution
The count is now 7
The count is now 10
The count is now 13
The count is now 16
The count is now 19
The count is now 22
The count is now 25
The count is now 28
*)